
<div>
	<div id="order_see-html">
	<section class="order">

		<div class="titles fiex">
			<div class="black"><a href="javascript:window.history.go(-1);" ><svg class="g2" ><use xlink:href="#f_black"></use></svg></a></div>
				<div class="fiex1 f-30 ellipsis"><span  data-l="1018"></span></div>
			</div>
		
		<div class="bank80"></div>
		
	   
	    <div class="order-mode"></div>
		
	    <script id="order-mode-js1" type="text/html">
			
			<div class="cf  f-30 pad-20">
				<div class="fl">
					<i data-l="1050"></i><span class="sum red" style="padding-left: 0.2rem;">{{order_info.shop_table_name}}</span>
				</div>
				 <div class="oh f-right"><em class="lang" data-l="1051"></em><span class="red">{{order_info.addtime}}</span></div>
	        </div>
	     	{{if order_info.remarks}}
	        <div class="order-bank"></div>
	        <div class="order-t3 cf">
	            <div class="fl f1 f-30 lang" data-l="1021"></div>
	            <div class="oh f2"><div class="oh f-30 f-right" >{{order_info.remarks}}</div></div>
	        </div>
	        {{/if}}
	        <div class="order-bank"></div>
			<div class="order-tab-head s2  mag-l-20 mag-r-20 pad-t-20">
		        	<table>
		        		<tr>
		        			<td class="td1"><div class="w">.No</div></td>
		        			<td class="td2"><div class="w" data-l="1063"></div></td>
		        			<td class="td3" style="width: 18%;"><div class="w" data-l="1064"></div></td>
		        			<td class="td4"><div class="w" data-l="1065"></div></td>
		        		</tr>
		        	</table>
		        </div>
	     	{{if my_number}}
				
                {{each my_list as v i}}
                	{{if i==member_id}}
                	{{if i!=""}}<div class="n user cf">
                		<div class="fl red"><span data-l="1007"></span> </div>
                		<div class="fr"><span data-l="1061"></span> {{i}}</div>
                	</div>{{/if}}
                	<div class="car-ul order-art-list" style="padding-top: 0;">
                	{{each v as vv ii}}                	
                    {{if vv.status!=1}}                    	
                        <div class="item-l {{if vv.is_cancel>0}}nulls{{/if}}" id="item-l-{{vv.cart_id}}" data-goods_id="{{vv.goods_id}}" data-cart_id="{{vv.cart_id}}">
                        	{{if vv.is_cancel>0}}<span class="deltext" data-l="1058"></span>{{/if}}
				                <table>
				                   <tr class="item f-28">
				            	<td class="td1" {{if vv.remarks}}rowspan="2"{{/if}}><div class="w center">{{ii+1}}</div></td>
				    			<td class="td2">
				    				<div class="w ">
				    					{{if vv.iscustom==1}}<span class="type type3" data-l="1252"></span>{{/if}}
				    					{{if vv.is_pack==1}}<span class="type type0" data-l="1138"></span>{{/if}}
										{{if vv.is_wait==1}}<span class="type type1" data-l="1136"></span>{{/if}}
										{{if vv.is_give==1}}<span class="type type2" data-l="1137"></span>{{/if}}
										{{if vv.is_package_goods=="1"}}(<span data-l="1365"></span>){{/if}}
										<span>{{vv.goods_name}} </span>
					                	{{if vv.goods_spec_name}}<span class="c999">[{{vv.goods_spec_name}}]</span>{{/if}}
					                	{{if vv.goods_taste_name}}<span class="c999">[{{vv.goods_taste_name}}]</span>{{/if}} 
									 {{each vv.garnish_ids as vvv iii}}
					                    	<div class="clear"></div>
					                    	<div class="mag-l-15 f-22 c999 {{if iii==0}}mag-t-5{{/if}}">
					                        	{{vvv.goods_garnish_name}}
						                        <span class="red">x{{vvv.count}}</span>	
					                    	</div>
					                    {{/each}}	
					                    
					                    
					                     {{if vv.is_package_goods=="1"}}
											<div class="package " >
											{{each vv.package_cate_list as pack_v pack_i}}
											    <dl class="f-24 cf mag-t-5">
												<dt class="c999 fr f-right"  >{{pack_v.name}}</dt>
												<dd class="oh" >
												{{each vv.package_goods_list as pack_vv pack_ii}}
													{{if pack_v.id == pack_vv.cate_id}}
														<div>
														<p class="pad-l-10">
															{{caidan_json[pack_vv.goods_id].goods_name}}
															{{if pack_vv.spec_id!='0' && pack_vv.spec_id}}
															<span class="c999">[{{guige1_json[pack_vv.spec_id].goods_spec_name}}]</span>
															{{/if}}
															{{if pack_vv.taste_id!='0' && pack_vv.taste_id}}
															<span class="c999">[{{kouwei1_json[pack_vv.taste_id].goods_taste_name}}]</span>
															{{/if}}
															<span class="red"><i class="f-20">x</i> {{pack_vv.count}}</span>
														</p>
														{{each pack_vv.garnish_ids as pack_vvv pack_iii}}
															<p class="pad-l-20 f-10 c999 f-20">{{peicai_json[pack_vvv.garnish_id].goods_garnish_name}} x {{pack_vvv.count}}</p>
														{{/each}}
														</div>
													{{/if}}
													
												{{/each}}
												</dd>
												</dl>
											{{/each}}
											</div>
										{{/if}}
					                    
					                    
					                    
					    			</div>
				    			</td>
				    			<td class="td3" style="width: 18%;"><div class="w center bon">
				    				<span class="g3  red">{{vv.count}}</span>
				    			</div></td>
				    			<td class="td4"><div class="w center red">{{vv.total_price}}</div></td>
				            </tr>
				            		{{if vv.remarks}}
				        			<tr>
				        				<td colspan="3" class="td_bz"><div class="w aaa">{{vv.remarks}}</div></td>        				
				        			</tr>
				        			{{/if}}
				            </table>   
				                         <div class="bottoms" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="1" data-name="{{vv.goods_name}}"  data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                         
				                         </div>
				                 </div>
                      {{/if}}
                    {{/each}}
                    </div>
                    {{/if}}
                {{/each}}
            {{else}}
                <div class="nodata lang"  ><span data-l="1009"></span></div>
            {{/if}}
	       
	
				{{if th_number}} 

                {{each my_list as v i}}
                	{{if i!=member_id}}
                	{{if i!=""}}<div class="n user cf">
                		<div class="fl green"><span data-l="1008"></span> </div>
                		<div class="fr"><span data-l="1061"></span> {{i}}</div>
                	</div>{{/if}}
                	<div class="car-ul order-art-list" style="padding-top: 0;">
                	{{each v as vv ii}}                	
	                    {{if vv.status!=1}}                    	
	                        <div class="item-l f-24 {{if vv.is_cancel>0}}nulls{{/if}}" id="item-l-{{vv.cart_id}}" data-goods_id="{{vv.goods_id}}" data-cart_id="{{vv.cart_id}}">
	                        	{{if vv.is_cancel>0}}<span class="deltext" data-l="1058"></span>{{/if}}
				                <table>   
				                   <tr class="item">
				            	<td class="td1" {{if vv.remarks}}rowspan="2"{{/if}}><div class="w center">{{ii+1}}</div></td>
				    			<td class="td2">
				    				<div class="w ">
				    					
				    					{{if vv.iscustom==1}}<span class="type type3" data-l="1195"></span>{{/if}}
	                        	{{if vv.is_pack==1}}<span class="type type0" data-l="1138"></span>{{/if}}
								{{if vv.is_give==1}}<span class="type type2" data-l="1137"></span>{{/if}}
				    					{{if vv.is_package_goods=="1"}}(<span data-l="1365"></span>){{/if}}
										<span>{{vv.goods_name}} </span>
					                	{{if vv.goods_spec_name}}<span class="c999">[{{vv.goods_spec_name}}]</span>{{/if}}
					                	{{if vv.goods_taste_name}}<span class="c999">[{{vv.goods_taste_name}}]</span>{{/if}} 
									   {{each vv.garnish_ids as vvv iii}}
					                    	<div class="clear"></div>
					                    	<div class="mag-l-15 f-22 c999 {{if iii==0}}mag-t-5{{/if}}">
					                        	{{vvv.goods_garnish_name}}
						                        <span class="red">x{{vvv.count}}</span>	
					                    	</div>
					                    {{/each}}	   
					                    
					                    
					                    
					                     {{if vv.is_package_goods=="1"}}
											<div class="package " >
											{{each vv.package_cate_list as pack_v pack_i}}
											    <dl class="f-24 cf mag-t-5">
												<dt class="c999 fr f-right"  >{{pack_v.name}}</dt>
												<dd class="oh" >
												{{each vv.package_goods_list as pack_vv pack_ii}}
													{{if pack_v.id == pack_vv.cate_id}}
														<div>
														<p class="pad-l-10">
															{{caidan_json[pack_vv.goods_id].goods_name}}
															{{if pack_vv.spec_id!='0' && pack_vv.spec_id}}
															<span class="c999">[{{guige1_json[pack_vv.spec_id].goods_spec_name}}]</span>
															{{/if}}
															{{if pack_vv.taste_id!='0' && pack_vv.taste_id}}
															<span class="c999">[{{kouwei1_json[pack_vv.taste_id].goods_taste_name}}]</span>
															{{/if}}
															<span class="red"><i class="f-20">x</i> {{pack_vv.count}}</span>
														</p>
														{{each pack_vv.garnish_ids as pack_vvv pack_iii}}
															<p class="pad-l-20 f-10 c999 f-20">{{peicai_json[pack_vvv.garnish_id].goods_garnish_name}} x {{pack_vvv.count}}</p>
														{{/each}}
														</div>
													{{/if}}
													
												{{/each}}
												</dd>
												</dl>
											{{/each}}
											</div>
										{{/if}}
					                    
					                    
					    			</div>
				    			</td>
				    			<td class="td3" style="width: 18%;"><div class="w center bon">
				    				 <span class="g3  red">{{vv.count}}</span>
				    			</div></td>
				    			<td class="td4"><div class="w center red">{{vv.total_price}}</div></td>
				            </tr>
				            		{{if vv.remarks}}
				        			<tr>
				        				<td colspan="3" class="td_bz"><div class="w aaa">{{vv.remarks}}</div></td>        				
				        			</tr>
				        			{{/if}}
				                         </table>   
				                         <div class="bottoms" data-parent-id="{{vv.goods_cate_id}}"  data-cart_id="{{vv.cart_id}}" data-id="{{vv.goods_id}}" data-num="1" data-name="{{vv.goods_name}}"  data-price="{{vv.goods_price}}" data-specid="{{vv.spec_id}}" data-goodsspecid="{{vv.goods_spec_id}}">
				                         
				                         </div>
				                 </div>
	                    {{/if}}
                    {{/each}}
                    </div>
                    {{/if}}
                {{/each}}
            {{else}}
                <!--<div class="nodata lang"  ><span data-l="1010"></span></div>-->
            {{/if}}
			 
			         <div class="order-bank"></div>
	    <div class="bank100"></div>
	    <div class="bank100"></div>
	
		<div class="order-bon f-30">
			<div class="cf">
				<div class="fl f-22 pad-l-10 f-left" style="line-height: 1.3;">
					<p><span data-l="1197"></span> <span class="red">{{order_info.goods_total_price}}</span></p>
					<p><span data-l="1198"></span> <span class="red">{{order_info.tax_service_price}}</span></p>
					<p><span data-l="1199"></span> <span class="red">{{order_info.tax_excise_price}}</span></p>
				</div>
				
				<div class="oh order-price red f-30 f-right">
		            <i data-l="1024"></i>：<span class="sum">{{order_info.total_price}}</span>
		        </div>
			</div>
	        
	    </div>
	    </script>

	    
	</section>
	
	<Script>
	  
	    $(".order-bon .a2").click(function () {
	    if ($(this).hasClass("null")) return false;
	    global_ajax(jsonpath + "put_shop_order_confirm", { remarks: localStorage.getItem("note") }, function (e) {
	        Q.go("main/finish")
	    })
	})
	
	        var setselect_item2=function(){
	    	
	    	global_ajax(jsonpath + "get_shop_buy_page",{type:2}, function (e) {
	        //初始化已选数据
	                cart_obj_ss = {
	                	"total_money":0,
	                	"my_number": 0,
	                	"th_number": 0,
	                	"open_other":false,
	                    "member_id": getCookie("yingsoft_home_member_id"),
	                    "my_list": {},
	                    "cart_id_list": {},
	                    "order_info":e.result.order_info
	                }
	    
	                $(".title1").text(cart_obj_ss.order_info.shop_table_name);//设置title
					$.each(e.result.cart_goods_list, function (i0, v0) {
						cart_obj_ss.my_list[i0]=[];
						console.log(v0);
		                $.each(v0, function (i, v) {
		                	if(v.status!=1){
			                	//添加名称 规格名称	
			                	var name1,guige,kouwei;
//			                		if(caidan_json[v.goods_id]!=undefined )
//				                	{
//				                    name1 = caidan_json[v.goods_id].goods_name;
//				                   }
				                	if(guige1_json[v.spec_id]!=undefined )
				                	{
				                		guige = v.spec_id!=0 ? guige1_json[v.spec_id].goods_spec_name :null
				                	}
				                	if(kouwei1_json[v.taste_id]!=undefined )
				                	{
				                		kouwei = v.taste_id!=0 ? kouwei1_json[v.taste_id].goods_taste_name:null;
				                	}
				                   // alert(JSON.stringify(guige1_json))
				                  //  v["goods_name"]=name1;
				                    v["goods_spec_name"]=guige;
				                    v["goods_taste_name"]=kouwei;
				                    
			                    	$.each(v.garnish_ids, function (ii, vv) {
			                    		var name2 = peicai_json[vv.garnish_id].goods_garnish_name;
			                    		vv["goods_garnish_name"]=name2;
			                    	});
			                    	//console.log(v.garnish_ids)
			                    	
			                  
			                    cart_obj_ss.my_list[i0].push(v)
			                    cart_obj_ss.cart_id_list[v.cart_id]=1;
							}
	                  })//匹配数据
	                 })//匹配数据
	 				//$(".carbuy .car-tit .fr").click();
	                marry_fun();
	        })
	    }
	    
	  
		
	    //匹配以选择数据
	    var marry_fun = function (data) {
			
			//处理新插入的数据
			var newd1=true//是否新增数据
			if (data!=undefined)
	        {
	        	var data1 = JSON.parse(data).data,
	        	slist=cart_obj_ss.my_list[data1.member_id];
	        	
				if(slist!=undefined)
				{
					var sss=getjsons(slist,data1.cart_id,'cart_id'),
						sssid=getindex(slist,data1.cart_id,'cart_id')
	        		if(sss.cart_id!=undefined)
					{
	 					newd1=false;
	 					var myobj=$(".my-list li[data-goodsspecid="+ data1.goods_spec_id +"]");
						if(data1.count==0){
							//删除数据
							var ind=getindex2(cart_obj_ss.my_list,data1.goods_spec_id,'goods_spec_id',data1.member_id,'member_id');
							cart_obj_ss.my_list.baoremove(ind);
							myobj.remove()
						}else{
							slist[sssid]=setaddss(data1)//更新数量
							console.log(slist[sssid])
							//更新界面							
							//myobj.find(".addright").attr("data-num", data1.count);
							//myobj.find(".addright").find(".g3").text(data1.count);
						}
					}
					
				}
				//判断是否新增数据
				if(newd1){                    	
	                //添加名称 规格名称                    	
		                if(!!!cart_obj_ss.my_list[setaddss(data1).member_id]) cart_obj_ss.my_list[setaddss(data1).member_id]=[];		                
	                	cart_obj_ss.my_list[setaddss(data1).member_id].push(setaddss(data1))
				}
	        	//更新界面数字状态；
	        }
			
			function setaddss(data1){
				var ss=data1;   
				if(ss.is_package_goods!=1){//如果不能用套餐调用
	            var name1 = caidan_json[ss.goods_id].goods_name,
	            	guige = ss.spec_id!=0 ? guige1_json[ss.spec_id].goods_spec_name :null,
		            kouwei = ss.taste_id!=0 ? kouwei1_json[ss.taste_id].goods_taste_name:null;
	            	ss["goods_name"]=name1;
	            	ss["goods_spec_name"]=guige;
	            	ss["goods_taste_name"]=kouwei;
	            	
	            	$.each(ss.garnish_ids, function (ii, vv) {
	            		var name2 = peicai_json[vv.garnish_id].goods_garnish_name;
	            		vv["goods_garnish_name"]=name2;
	            	});
	           }
	            	return ss;
			}
			
			
	          //购物车列表
	    	$(".menu-left li i,.select-buy .left .gw i,.select-buy .left .gw em").text("");
	    	var objs=$(".menu-right .item"),
				nums=objs.find(".addright").attr("data-num",0);
	    	cart_obj_ss.th_number=0;
	    	cart_obj_ss.my_number=0;
	    	cart_obj_ss.total_money=0;
	        $.each(cart_obj_ss.my_list, function (ii, vv) {
	            
	            	 //判断是否有其他用户
	            	if(cart_obj_ss.member_id != ii){
	            		cart_obj_ss.open_other=true;	
	            		$.each(vv, function (i, v) {
	            			if(v.status!=1){
	            			cart_obj_ss.th_number += Number(v.count);
	            			cart_obj_ss.total_money = accAdd(cart_obj_ss.total_money, v.total_price)
	            			}
	            		})
	            	}else{
	            		$.each(vv, function (i, v) {
	            			if(v.status!=1){
	                		cart_obj_ss.my_number += Number(v.count);
	                		
		                    //设置总价
		                    cart_obj_ss.total_money = accAdd(cart_obj_ss.total_money, v.total_price)
		                    
		                    
		                    
		                   }
	                   })
	            	}
	            	//总价
	            	
	
	        })
	        
	        //格式化金额
	        cart_obj_ss.total_money=toFixed2(cart_obj_ss.total_money, 2)
	        $("#total_price span").text(cart_obj_ss.total_money);
	        
	        //清空数据调用
	        if (cart_obj_ss.my_number == 0 && cart_obj_ss.th_number == 0) {
	        	$(".menu-right .item").removeClass("add")
	        	$(".select-menu").removeClass("open-gwc");
	        	$(".select-buy").removeClass("open");
	        	$(".menu-right .item .g3").text(0);
			    $(".menu-right .item .addright").attr("data-num", 0);
	        } 
	        if (cart_obj_ss.my_number > 0) {
	            $(".select-buy").addClass("open");
	            $(".select-buy .left .gw i").text(cart_obj_ss.my_number);
	        }
	        if (cart_obj_ss.th_number > 0) {
	        	$(".car-box").removeClass("open-otehr"); 
	            $(".select-buy").addClass("open");
	            $(".select-buy .left .gw em").text(cart_obj_ss.th_number);
	        }else{
	        	$(".car-box").addClass("open-otehr"); 
	        }
	        //
	        console.log(cart_obj_ss)
	        
	        
	        cart_obj_ss['caidan_json']=caidan_json
			cart_obj_ss['guige1_json']=guige1_json
			cart_obj_ss['kouwei1_json']=kouwei1_json
			cart_obj_ss['peicai_json']=peicai_json
	        //只有添加新数据才更新模板
	        $(".order-mode").html(template("order-mode-js1", cart_obj_ss));
	
	        
	
	        setlange_obj()//设置前端语言
	        
	        
	    }
	
		
		
		 //
		 
	        if(localStorage.getItem("key1")!=null){
	        	
	        	caidan_json=JSON.parse(localStorage.getItem("key2"));
			    guige1_json=JSON.parse(localStorage.getItem("key3"));
			    kouwei1_json=JSON.parse(localStorage.getItem("key4"));
			    peicai_json=JSON.parse(localStorage.getItem("key5"));
	        	
	        	setselect_item2();
	        }else
	        {
	        	
	       $.showLoading();
	       
	       $.ajax({
	        type: "get",
	        dataType: "json",
	        url: "http://foodievc.oss-ap-southeast-1.aliyuncs.com/shop_goods/"+ getCookie("shopid") +"_"+getCookie("language")+".json",
	        cache: false,
	        success: function (e) {
	        	 //设置返回值
	        	 	 $.hideLoading();
		               localStorage.setItem("key1", JSON.stringify(e))
		               
		               var key2={},key3={},key4={},key5={};
		               $.each(e.result.list,function(i,v){
		               		if(v.id==1||v.id==2){}else{
		               			$.each(v.goods_list,function(ii,vv){               				
		               				key2[vv.id]=vv;		               				
		               			})               			
		               		}
		               });
		               $.each(e.result.spec_list,function(iii,vvv){
	       					key3[vvv.spec_id]=vvv;
	       				})
	       				$.each(e.result.taste_list,function(iii,vvv){
	       					key4[vvv.taste_id]=vvv;
	       				})
	       				$.each(e.result.garnish_list,function(iii,vvv){
	       					key5[vvv.garnish_id]=vvv;
	       				})
		               
					  //设置菜品
					   localStorage.setItem("key2", JSON.stringify(key2))
					   localStorage.setItem("key3", JSON.stringify(key3))
					   localStorage.setItem("key4", JSON.stringify(key4))
					   localStorage.setItem("key5", JSON.stringify(key5))
					   caidan_json=key2;
					   guige1_json=key3;
					   kouwei1_json=key4;
					   peicai_json=key5;
	            		
	            	setselect_item2();
	            		
	        },
	        error: function () {
	            console.log("接口错误！")
	        }
	       })
	        	
	       
	        }            
	        //
		
		

	</Script>
	</div>
</div>

